import requests
import unittest
# 导入封装的包
from unit__001.unit_01.Tools import Tools
from ddt import ddt,file_data

from unit__001.unit_01.excel import excel

path = r'/unit__001/unit_01/excel.xlsx'
sheetname = 'Sheet1'
dy = excel(path, sheetname)

@ddt
class A3mall(unittest.TestCase):
    def setUp(self) -> None:
        print('start case')

    def tearDown(self) -> None:
        print('end case')

    # 注册
    def test_A3mall_01(self):
        # 调用封装注册的方法
        register = Tools().register('http://10.59.9.14:7003', '18185603006', '123456')
        print(register.json())

    token = None

    # 登录
    @file_data('data.yaml')
    def test_A3mall_02(self,username,password):
        # 调用封装登录的方法
        login, A3mall.token = Tools().login('http://10.59.9.14:7003', username, password)
        print(login.json())
        # print(A3mall.token)


if __name__ == '__main__':
    unittest.main()
